/* 聊天历史页面样式 */

.chat-history-container {
    max-width: 800px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

/* 当聊天窗口打开时，调整历史记录容器的样式 */
.page-container.chat-open .chat-history-container {
    max-width: 100%;
    margin: 0;
}

/* 流式聊天测试区域样式 */
.stream-chat-test {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.stream-chat-test h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
}

.stream-chat-test p {
    margin: 0 0 20px 0;
    color: #6B7280;
    font-size: 14px;
}

.stream-chat-container {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
}

.stream-chat-container .chat-messages {
    height: 300px;
    overflow-y: auto;
    padding: 16px;
    background: #F8FAFC;
}

.stream-chat-container .chat-input-container {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #FFFFFF;
    border-top: 1px solid #E5E7EB;
}

.stream-chat-container textarea {
    flex: 1;
    border: 1px solid #E5E7EB;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    resize: vertical;
    transition: border-color 0.2s;
}

.stream-chat-container textarea:focus {
    outline: none;
    border-color: #2A5CAA;
}

.stream-chat-container textarea:disabled {
    background: #F9FAFB;
    color: #6B7280;
    cursor: not-allowed;
}

.stream-chat-container button {
    background: #2A5CAA;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.stream-chat-container button:hover:not(:disabled) {
    background: #1e4788;
}

.stream-chat-container button:disabled {
    background: #9CA3AF;
    cursor: not-allowed;
}

/* 流式消息样式 */
.stream-chat-container .message {
    margin-bottom: 12px;
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
}

.stream-chat-container .user-message {
    background: linear-gradient(135deg, #2A5CAA, #1e4788);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.stream-chat-container .ai-message {
    background: #FFFFFF;
    color: #1F2937;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid #E5E7EB;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stream-chat-container .message.streaming {
    background: #F0F8FF;
    border: 2px solid #4FC3F7;
    animation: pulse 1.5s infinite;
}

/* 流式聊天Markdown样式 */
.stream-chat-container .ai-message h1, .stream-chat-container .ai-message h2, 
.stream-chat-container .ai-message h3, .stream-chat-container .ai-message h4, 
.stream-chat-container .ai-message h5, .stream-chat-container .ai-message h6 {
    margin: 6px 0 3px 0;
    color: #1F2937;
    font-weight: 600;
}

.stream-chat-container .ai-message h1 { font-size: 16px; }
.stream-chat-container .ai-message h2 { font-size: 15px; }
.stream-chat-container .ai-message h3 { font-size: 14px; }
.stream-chat-container .ai-message h4, .stream-chat-container .ai-message h5, 
.stream-chat-container .ai-message h6 { font-size: 13px; }

.stream-chat-container .ai-message p {
    margin: 3px 0;
    line-height: 1.4;
}

.stream-chat-container .ai-message ul, .stream-chat-container .ai-message ol {
    margin: 3px 0;
    padding-left: 16px;
}

.stream-chat-container .ai-message li {
    margin: 1px 0;
    line-height: 1.3;
}

.stream-chat-container .ai-message blockquote {
    margin: 6px 0;
    padding: 6px 10px;
    border-left: 3px solid #E5E7EB;
    background-color: #F9FAFB;
    color: #6B7280;
    font-style: italic;
}

.stream-chat-container .ai-message code {
    background-color: #F3F4F6;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #DC2626;
}

.stream-chat-container .ai-message pre {
    background-color: #1F2937;
    color: #F9FAFB;
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 6px 0;
    font-size: 12px;
}

.stream-chat-container .ai-message pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

.stream-chat-container .ai-message strong {
    font-weight: 600;
    color: #111827;
}

.stream-chat-container .ai-message em {
    font-style: italic;
    color: #374151;
}

.stream-chat-container .ai-message a {
    color: #2563EB;
    text-decoration: none;
}

.stream-chat-container .ai-message a:hover {
    text-decoration: underline;
}

.stream-chat-container .ai-message table {
    border-collapse: collapse;
    width: 100%;
    margin: 6px 0;
    font-size: 12px;
}

.stream-chat-container .ai-message th, .stream-chat-container .ai-message td {
    border: 1px solid #E5E7EB;
    padding: 4px 6px;
    text-align: left;
}

.stream-chat-container .ai-message th {
    background-color: #F9FAFB;
    font-weight: 600;
}

.stream-chat-container .ai-message hr {
    border: none;
    border-top: 1px solid #E5E7EB;
    margin: 8px 0;
}

@keyframes pulse {
    0% { border-color: #4FC3F7; }
    50% { border-color: #29B6F6; }
    100% { border-color: #4FC3F7; }
}

.conversations-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.conversation-item {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.conversation-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #2A5CAA;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.conversation-title {
    font-size: 16px;
    font-weight: 600;
    color: #1F2937;
    margin: 0;
    flex: 1;
}

.conversation-date {
    font-size: 12px;
    color: #9CA3AF;
    margin-left: 16px;
}

.conversation-preview {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.5;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.conversation-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #9CA3AF;
}

.message-count {
    display: flex;
    align-items: center;
    gap: 4px;
}

.delete-btn {
    background: none;
    border: none;
    color: #EF4444;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 12px;
}

.delete-btn:hover {
    background: #FEE2E2;
}

.no-conversations {
    text-align: center;
    padding: 80px 20px;
    color: #6B7280;
}

.no-conversations h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 16px 0 8px;
    color: #374151;
}

.no-conversations p {
    font-size: 14px;
    margin: 0 0 24px 0;
}

.start-chat-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2A5CAA;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.start-chat-btn:hover {
    background: #1e4788;
    transform: translateY(-1px);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .chat-history-container {
        max-width: 100%;
        padding: 0 16px;
    }
    
    .page-container.chat-open .chat-history-container {
        padding: 0 12px;
    }
    
    .conversation-item {
        padding: 16px;
    }
    
    .conversation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .conversation-date {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .chat-history-container {
        padding: 0 12px;
    }
    
    .page-container.chat-open .chat-history-container {
        padding: 0 8px;
    }
    
    .conversation-item {
        padding: 12px;
    }
    
    .conversation-title {
        font-size: 15px;
    }
    
    .conversation-preview {
        font-size: 13px;
    }
}
